cmake_minimum_required(VERSION 3.16)

project(plugin-template)

set(TOP_DIR ${CMAKE_CURRENT_LIST_DIR}/../../)
set(PLUGIN_TEMPLATE_TOP_DIR ${CMAKE_CURRENT_LIST_DIR})
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

add_library(${PROJECT_NAME} SHARED)

target_compile_options(${PROJECT_NAME} PRIVATE -Wall -g -rdynamic)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)

find_package(Qt5 COMPONENTS Widgets REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Widgets)

set(SRCS
    "${PLUGIN_TEMPLATE_TOP_DIR}/connector.cpp"
    "${PLUGIN_TEMPLATE_TOP_DIR}/plugin.cpp"
    "${TOP_DIR}/interface/kymanager_plugin.cpp")

target_include_directories(${PROJECT_NAME} PRIVATE ${TOP_DIR}/interface)
target_include_directories(${PROJECT_NAME} PRIVATE ${TOP_DIR}/3rdparty/kyplugin)
target_include_directories(${PROJECT_NAME} PRIVATE ${PLUGIN_TEMPLATE_TOP_DIR})
target_sources(${PROJECT_NAME} PRIVATE ${SRCS})

install(TARGETS ${PROJECT_NAME} DESTINATION /opt/kylin-os-manager/plugins/)